package com.briup.app05.web.controller;

import com.briup.app05.bean.Article;
import com.briup.app05.service.IArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description = "栏目管理相关接口")
@RestController
@RequestMapping("/cms_article")
public class ArticleController {
    @Autowired
    private IArticleService articleService;
    @GetMapping("findAll")

    @ApiOperation("查询所有")
   public List<Article> findAll(){
      return articleService.findAll();
    }
    @ApiOperation("修改所有")
    @PostMapping("saveOrUpdate")
    public String saveOrUpdate(Article article){
      articleService.saveOrUpdate(article);
      return  "操作成功";
    }
    @ApiOperation("删除所有")
    @GetMapping("delete")
    public  String  delete(Long id){
        articleService.delete(id);
        return  "删除成功";
    }
}
